package com.lt.bookkeeping.recycleView;

import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.lt.bookkeeping.R;
import com.lt.bookkeeping.Utils.ViewUtils;

/**
 * @author LiuTong
 */
public class FootViewHolder extends BaseHolder<Integer>{

    private TextView textView;
    private ProgressBar progressBar;
    public static int LOADING = 0,FINISHED = 1,NO_DATA = 2;
    public FootViewHolder(@NonNull View itemView) {
        super(itemView);


    }

    @Override
    public void initView(View view) {
        textView = itemView.findViewById(R.id.footText);
        progressBar = itemView.findViewById(R.id.footProgressBar);
    }

    @Override
    public void onBind(Integer status){
        if(status == LOADING){
            textView.setText("正在加载中...");
            ViewUtils.setViewVisible(progressBar);
        } else if(status == FINISHED){
            textView.setText("加载完成");
            ViewUtils.setViewGone(progressBar);
        } else {
            textView.setText("数据全部加载完成");
            ViewUtils.setViewGone(progressBar);

        }
    }
}
